import asyncio
import time
from time import sleep


async def func():
    # 当程序出现同步操作时 异步就会中断
    # sleep(3)
    await asyncio.sleep(3) # 异步操作
    print("000按等级划分把握了部分哎")


async def func1():
    print("111按等级划分把握了部分哎")
    await asyncio.sleep(1)
    print("111按等级划分把握了部分哎")


async def func2():
    print("222按等级划分把握了部分哎")
    await asyncio.sleep(2)
    print("222按等级划分把握了部分哎")


async def func3():
    print("333按等级划分把握了部分哎")
    await asyncio.sleep(3)
    print("333按等级划分把握了部分哎")


async def func4():
    print("444按等级划分把握了部分哎")
    await asyncio.sleep(4)
    print("444按等级划分把握了部分哎")


async def main():
    # g = func1()
    # asyncio.run(g)

    task1 = asyncio.create_task(func1())
    task2 = asyncio.create_task(func2())
    task3 = asyncio.create_task(func3())
    task4 = asyncio.create_task(func4())
    tasks = [
        task1,task2,task3,task4
    ]
    await asyncio.wait(tasks)

if __name__ == '__main__':
    t1 = time.time()
    asyncio.run(main())
    t2 = time.time()
    print(t2 - t1)

